﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using HKEA.CMS.Core.BLL;
using HKEA.CMS.Core.Models;
using HKEA.CMS.Core.Utility;
using HKEA.CMS.Core.BLL.Tbl;

namespace WebApplication
{
    public partial class MediaRoomVideo : BasePage
    {
        protected string CustUID = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string cuid = Request.QueryString[Constant.UrlParamName.CustomerUID];
                if (!string.IsNullOrEmpty(cuid))
                {
                    CustUID = cuid;
                    BindDataSource();
                    hyMediaRoomImg.NavigateUrl = "MediaRoomImg.aspx?cuid=" + CustUID;
                }
            }
        }

        private void BindDataSource()
        {
            tblMediaRoomBLL bll = new tblMediaRoomBLL();
            List<tblMediaRoom> listAll = new List<tblMediaRoom>();
            tblMediaRoom entPara = new tblMediaRoom();
            entPara.CustomerUID = int.Parse(CustUID);
            entPara.MediaType = Constant.MediaType.video;
            entPara.IsPublish = -1;
            listAll = bll.GetListByENT(entPara);

            rp_BranchVideo.DataSource = listAll.Where(a => a.Category == Constant.MediaRoomCategory.branch_video);
            rp_BranchVideo.DataBind();
        }
    }
}